﻿@{
    ViewBag.Title = "病历填写";
    Layout = "~/Areas/PR/Views/Shared/_Layout.cshtml";
}

@section scripts{
    <script type="text/javascript">
        //#region 为Combobox增加--请选择--
        function EUIcombobox(jqS, o) {
            $.ajax({
                type: "POST",
                async: false,
                url: o.url,
                dataType: "JSON",
                success: function (data1, textStatus, jqXHR) {
                    o.data = o.OneOption.concat(data1);
                    delete o.url;
                    delete o.OneOption;
                    $(jqS).combobox(o);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert("获取字典数据失败！可能是已经超时，请重新登录！");
                }
            });
        }
        //#endregion

        //#region 弹出信息窗口
        /*
        title:标题
        msgString:提示信息
        msgType:信息类型 [error,info,question,warning]
        */
        function msgShow(title, msgString, msgType) {
            $.messager.alert(title, msgString, msgType);
        }
        //#endregion


        //#region 禁用Backspace键
        window.onload = function () {
            document.getElementsByTagName("body")[0].onkeydown = function () {

                //获取事件对象
                var elem = event.relatedTarget || event.srcElement || event.target || event.currentTarget;

                if (event.keyCode == 8) {//判断按键为backSpace键

                    //获取按键按下时光标做指向的element
                    var elem = event.srcElement || event.currentTarget;

                    //判断是否需要阻止按下键盘的事件默认传递
                    var name = elem.nodeName;

                    if (name != 'INPUT' && name != 'TEXTAREA') {
                        return StopBackspace(event);
                    }
                    var type_e = elem.type.toUpperCase();
                    if (name == 'INPUT' && (type_e != 'TEXT' && type_e != 'TEXTAREA' && type_e != 'PASSWORD' && type_e != 'FILE')) {
                        return StopBackspace(event);
                    }
                    if (name == 'INPUT' && (elem.readOnly == true || elem.disabled == true)) {
                        return StopBackspace(event);
                    }
                }
            }
        }
        function StopBackspace(e) {
            if (e.returnValue) {
                e.returnValue = false;
            }
            if (e.preventDefault) {
                e.preventDefault();
            }

            return false;
        }
        //#endregion

        //页面初始化
        $(document).ready(function () {
            //$(".datebox :text").attr("readonly", "readonly");//设置时间控件只能选择，不可手动输入

            //#region 事件类型
            EUIcombobox("#alarmEventType", {
                url: '@Url.Content("~/Medical/GetAlarmEventType/")',
                valueField: 'ID',
                textField: 'Name',
                editable: false,
                panelHeight: 'auto',
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }]
            });
            //#endregion

            //#region 分中心
            EUIcombobox("#centerCode", {
                url: '@Url.Content("~/Medical/GetCenter/")',
                valueField: 'ID',
                textField: 'Name',
                //prompt: '--请选择--',
                //editable: false,
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }],
                onSelect: function (rec) {
                    var urlstation = '@Url.Content("~/Medical/GetStation?code=")' + rec.ID;
                    EUIcombobox("#stationCode", {
                        url: urlstation,
                        valueField: 'ID',
                        textField: 'Name',
                        //prompt: '--请选择--',
                        editable: false,
                        OneOption: [{
                            ID: "",
                            Name: "--请选择--"
                        }]
                    });
                }
            });
            //#endregion

            //#region 出车分站
            EUIcombobox("#stationCode", {
                url: '@Url.Content("~/Medical/GetStation?code=")',
                valueField: 'ID',
                textField: 'Name',
                //prompt: '--请选择--',
                editable: false,
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }],
                onSelect: function (rec) {
                    var urlambCode = '@Url.Content("~/Medical/GetAmbulance?code=")' + rec.ID;
                    EUIcombobox("#ambCode", {
                        url: urlambCode,
                        valueField: 'ID',
                        textField: 'Name',
                        //prompt: '--请选择--',
                        //editable: false,
                        OneOption: [{
                            ID: "",
                            Name: "--请选择--"
                        }]
                    });
                }
            });
            //#endregion

            //#region 车辆
            EUIcombobox("#ambCode", {
                url: '@Url.Content("~/Medical/GetAmbulance?code=")',
                valueField: 'ID',
                textField: 'Name',
                //editable: false,
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }]
            });
            //#endregion

            //#region 病情分类--20160518
            EUIcombobox("#illState", {
                url: '@Url.Content("~/Medical/GetMSDictionaryInfo/?TypeCode=")' + 'IllState',
                valueField: 'Name',
                textField: 'Name',
                editable: false,
                panelHeight: 'auto',
                value: '--请选择--',
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }],
                onChange: function (param) {

                }
            });
            //#endregion

            //#region 送往地点--医院
            EUIcombobox("#SendAddress", {
                url: '@Url.Content("~/Medical/GetHospitalInfo/")',
                valueField: 'Name',
                textField: 'Name',
                //editable: false,
                value: '--请选择--',
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }],
                onChange: function (param) {

                }
            });
            //#endregion

            //#region 调度员
            @*EUIcombobox("#disCode", {
            url: '@Url.Content("~/Medical/GetDispatcher/")',
            valueField: 'ID',
            textField: 'Name',
            //editable: false,
            OneOption: [{
                ID: "",
                Name: "--请选择--"
            }]
        });*@
            //#endregion

            //#region 异常结束原因20160328注释
            @*EUIcombobox("#taskAbendReason", {
                url: '@Url.Content("~/Medical/GetZTaskAbendReason/")',
                valueField: 'ID',
                textField: 'Name',
                editable: false,
                panelHeight: 'auto',
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }]
            });*@
            //#endregion

            ////#region 出车结果
            //$('#taskResult').combobox({
            //    valueField: 'ID',
            //    textField: 'Name',
            //    method: 'get',
            //    editable: false,
            //    panelHeight: 'auto',
            //    value: '',
            //    data: [{
            //        ID: '-1',
            //        Name: '--请选择--',
            //        //selected: true //默认选中项
            //    }, {
            //        ID: 'True',
            //        Name: '正常',
            //    }, {
            //        ID: 'False',
            //        Name: '异常结束'
            //    }],
            //    //onChange: function (rec) {
            //    //    //选中事件
            //    //}
            //});
            ////#endregion

            ////#region 病历情况
            //$('#isFill').combobox({
            //    valueField: 'ID',
            //    textField: 'Name',
            //    method: 'get',
            //    editable: false,
            //    panelHeight: 'auto',
            //    value: '',
            //    data: [{
            //        ID: '-1',
            //        Name: '--请选择--',
            //        //selected: true //默认选中项
            //    }, {
            //        ID: 'True',
            //        Name: '已填',
            //    }, {
            //        ID: 'False',
            //        Name: '未填'
            //    }],
            //});
            ////#endregion

            ////#region 收费情况
            //$('#isCharge').combobox({
            //    valueField: 'ID',
            //    textField: 'Name',
            //    method: 'get',
            //    editable: false,
            //    panelHeight: 'auto',
            //    value: '',
            //    data: [{
            //        ID: '-1',
            //        Name: '--请选择--',
            //        //selected: true //默认选中项
            //    }, {
            //        ID: 'True',
            //        Name: '已收',
            //    }, {
            //        ID: 'False',
            //        Name: '未收'
            //    }, {
            //        ID: 'Qian',
            //        Name: '欠费',
            //    }],
            //});
            ////#endregion

            var now = new Date();
            //$("#startTime").datetimebox("setValue", $.GetYesterday());//开始时刻
            //$("#endTime").datetimebox("setValue", $.GetTomorrow());//终止时刻
            $('#startTime').datetimebox('setValue', '@ViewData["startTime"]');
            $('#endTime').datetimebox('setValue', '@ViewData["endTime"]');

            bindGrid();

        });


        function bindGrid() {
            var WorkCode = '@ViewData["WorkCode"]';
            if (WorkCode == '' && '@ViewData["WorkCode"]' != "") {
                $.showMsg("请联系技术人员！管理系统人员工号为空，无法查询信息！", "提示");
            }
            var startTime = $("#startTime").datetimebox('getValue');
            var endTime = $('#endTime').datetimebox('getValue');
            startTime = startTime.replace(/-/g, "/");
            endTime = endTime.replace(/-/g, "/");
            var date1 = Date.parse(startTime);
            var date2 = Date.parse(endTime);

            //var d1 = new Date(startTime.replace(/-/g, "/"));
            //var d2 = new Date(endTime.replace(/-/g, "/"));
            var day = Math.ceil((date2 - date1) / (24 * 60 * 60 * 1000));
            if (day < 200) {
                $('#gridPatientList').datagrid({
                    //title: '病历填写',
                    type: "POST",
                    url: '@Url.Content("~/PR/Medical/DataLoad")',
                    height: 'auto',
                    nowrap: false,
                    striped: true,
                    border: true,
                    collapsible: false,//是否可折叠的
                    pagination: true,//分页控件
                    rownumbers: true,//行号
                    //sortName: 'code',
                    //sortOrder: 'desc',
                    remoteSort: false,
                    //idField: 'TaskCode',
                    singleSelect: true,//是否单选
                    fit: true,//自动大小
                    fitColumns: false,
                    toolbar: '#tb',
                    loadMsg: '数据加载中请稍后……',
                    pageSize: 15,//每页显示的记录条数，默认为10
                    pageList: [10, 15, 20],//可以设置每页记录条数的列表
                    queryParams: {
                        startTime: $("#startTime").datetimebox('getValue'),
                        endTime: $('#endTime').datetimebox('getValue'),
                        isTest: SplitArray(GetCheckBox("isTest")),//$('#isTest').val(),
                        patientName: $('#patientName').val(),
                        linkPhone: $('#linkPhone').val(),
                        alarmEventType: $('#alarmEventType').combobox('getValue') == "" ? -1 : $('#alarmEventType').combobox('getValue'),
                        localAddr: $('#localAddr').val(),
                        driver: $('#driver').val(),
                        centerCode: $('#centerCode').combobox('getValue') == "" ? -1 : $('#centerCode').combobox('getValue'),
                        stationCode: $('#stationCode').combobox('getValue') == "" ? -1 : $('#stationCode').combobox('getValue'),
                        ambCode: $('#ambCode').combobox('getValue') == "" ? -1 : $('#ambCode').combobox('getValue'),
                        doctor: $('#doctor').val(),
                        litter: $('#taskOrder').val(),
                        nurse: $('#nurse').val(),
                        taskResult: $('#taskResult').combobox('getValue') == "" ? -1 : $('#taskResult').combobox('getValue'),
                        taskAbendReason: $('#taskAbendReason').combobox('getValue') == "" ? -1 : $('#taskAbendReason').combobox('getValue'),
                        CPRIFSuccess: $('#CPRIFSuccess').combobox('getValue') == "" ? -1 : $('#CPRIFSuccess').combobox('getValue'),
                        PatientState: $('#PatientState').combobox('getValue') == "" ? -1 : $('#PatientState').combobox('getValue'),
                        isCharge: $('#isCharge').combobox('getValue') == "" ? -1 : $('#isCharge').combobox('getValue'),
                        isFill: $('#isFill').combobox('getValue') == "" ? -1 : $('#isFill').combobox('getValue'),
                        fapiaoHao: $('#fapiaoHao').val(),
                        illState: $('#illState').combobox('getValue') == "--请选择--" ? -1 : $('#illState').combobox('getValue'),
                        SendAddress: $('#SendAddress').combobox('getValue') == "--请选择--" ? -1 : isNullOrEmptyString($('#SendAddress').datebox('getText').replace(/\\/g, "")),
                        searchBound: '@ViewData["searchBound"]',
                        isYBPay: $('#IsYBPay').combobox('getValue') == "" ? -1 : $('#IsYBPay').combobox('getValue'), //20211019 plq 医保上线移植
                        isVideoRecord: $('#IsVideoRecord').combobox('getValue') == "" ? -1 : $('#IsVideoRecord').combobox('getValue'), //2024-10-22 plq 指导仪录像
                        isPatientImg: $('#IsPatientImg').combobox('getValue') == "" ? -1 : $('#IsPatientImg').combobox('getValue') //2024-11-15 plq 附件

                    },
                    view: detailview,
                    detailFormatter: function (index, row) {
                        return '<div style="padding:2px"><table id="ddv' + index + '"></table></div>';
                    },

                    onExpandRow: function (index, row) {
                        //var ddv = $(this).datagrid('getRowDetail', index).find('table.ddv');
                        if (row.PatientNumber >= 1) {
                            $('#ddv' + index).datagrid({
                                url: '@Url.Content("~/PR/Medical/GetPatientCommonByTask/?taskCode=")' + row.TaskCode,
                                fitColumns: true,
                                singleSelect: true,
                                rownumbers: true,
                                loadMsg: '',
                                height: 'auto',
                                width: 900,
                                //heigth: 30,
                                columns: [[
                                    { field: 'Name', title: '姓名', width: 10, align: 'center', sortable: false, resizable: false },
                                    { field: 'Sex', title: '性别', width: 10, align: 'center', sortable: false, resizable: false },
                                    { field: 'Age', title: '年龄', width: 10, align: 'center', sortable: false, resizable: false },
                                    { field: 'PatientVersion', title: '事件类型', width: 12, align: 'center', sortable: false, resizable: false },
                                    { field: 'SubmitLogo', title: 'SubmitLogo', width: '0%', sortable: false, hidden: true },
                                    { field: 'ForHelpTelephone', title: 'ForHelpTelephone', width: '0%', sortable: false, hidden: true },
                                    { field: 'CPRIFSuccess', title: '是否国家码交易', width: '0%', sortable: false, hidden: true },
                                    { field: 'Remark', title: 'Remark', width: '0%', sortable: false, hidden: true },
                                    { field: 'RescueType', title: 'RescueType', width: '0%', sortable: false, hidden: true },
                                    { field: 'FormCompleteLogo', title: 'FormCompleteLogo', width: '0%', sortable: false, hidden: true },
                                    { field: 'UpdateFormCompletePerson', title: 'UpdateFormCompleteTime', width: '0%', sortable: false, hidden: true },
                                    { field: 'DeathCertificate', title: 'CarNumber', width: '0%', sortable: false, hidden: true },
                                    { field: 'DiseaseCooperation', title: 'startTime', width: '0%', sortable: false, hidden: true },
                                    { field: 'DiseaseNotCooperationSupplement', title: 'endTime', width: '0%', sortable: false, hidden: true },
                                    { field: 'FormedConsent', title: 'IFExecuting', width: '0%', sortable: false, hidden: true },
                                    { field: 'MedicalStateCode', title: 'MedicalStateCode', width: '0%', sortable: false, hidden: true },
                                    {
                                        field: 'ForArea', title: '病历状态', width: 13, align: 'center', sortable: false, resizable: false,
                                        formatter: function (value, rec) {
                                            var LoginName = '@ViewData["LoginName"]';
                                            var FirstAcceptTime = Date.parse(row.FirstAcceptTime);//派车时刻
                                            var TimePatientRecordNotUp = Date.parse(('@ViewData["TimePatientRecordNotUp"]').replace(/-/g, "/"));//超时归档计算后值
                                            var UpdateFormCompleteTime = '';
                                            if (rec.UpdateFormCompletePerson != '') {
                                                UpdateFormCompleteTime = Date.parse(rec.UpdateFormCompletePerson);//病历退回操作时间
                                            }

                                            //如果病历状态：暂存，病历从派车时刻开始已经超过规定时间内提交病历
                                            if (rec.SubmitLogo == false && FirstAcceptTime <= TimePatientRecordNotUp
                                                && '@ViewData["UpdateFormCompleteRole"]' == "") {
                                                //alert(1);
                                                if (UpdateFormCompleteTime != '') {
                                                    if (UpdateFormCompleteTime > TimePatientRecordNotUp) {
                                                        return btn = '<a id="formComplete' + index + '" onclick="" >' + value + '</a>';
                                                    }
                                                    else {
                                                        return btn = '<a id="formComplete' + index + '" onclick="" >自动归档</a>';
                                                    }
                                                }
                                                else {
                                                    return btn = '<a id="formComplete' + index + '" onclick="" >自动归档</a>';
                                                }
                                            }
                                            else if (rec.SubmitLogo == false && FirstAcceptTime <= TimePatientRecordNotUp
                                                && '@ViewData["UpdateFormCompleteRole"]' == "UpdateFormCompleteRole") {
                                                if (UpdateFormCompleteTime != '') {
                                                    //alert(2);
                                                    if (UpdateFormCompleteTime <= TimePatientRecordNotUp) {
                                                        //alert(3);
                                                        return btn = '<a id="formComplete' + index + '" onclick="formComplete(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + LoginName + '\')" href="javascript:void(0)">自动归档</a>';
                                                    }
                                                    else {
                                                        //alert(4);
                                                        return btn = '<a id="formComplete' + index + '" onclick="" >' + value + '</a>';
                                                    }
                                                }
                                                else {
                                                    return btn = '<a id="formComplete' + index + '" onclick="formComplete(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + LoginName + '\')" href="javascript:void(0)">自动归档</a>';
                                                }

                                                if (rec.FormCompleteLogo == 0) {
                                                    return btn = '<a id="formComplete' + index + '" onclick="formComplete(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + LoginName + '\')" href="javascript:void(0)">自动归档</a>';
                                                }
                                            }
                                            else {
                                                //alert(5);
                                                return btn = '<a id="formComplete' + index + '" onclick="" >' + value + '</a>';
                                            }
                                        }
                                    },
                                    {
                                        field: 'OpenYBChargeMX', title: '查看医保交易', width: '9%', align: 'center', frozen: 'true',
                                        formatter: function (value, rec) {
                                            if (rec.RescueType == '0')
                                                return btn = '<a id="OpenYBChargeMX' + index + '">无交易</a>';
                                            else
                                                return btn = '<a id="OpenYBChargeMX' + index + '"  onclick="YBChargeMX(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\')" href="javascript:void(0)">医保交易</a>';
                                        }
                                    },
                                    {
                                        field: 'OpenGJMChargeMX', title: '查看国家码交易', width: '10%', align: 'center', frozen: 'true',
                                        formatter: function (value, rec) {
                                            if (rec.CPRIFSuccess == "0")
                                                return btn = '<a id="OpenGJMChargeMX' + index + '">无交易</a>';
                                            else
                                                return btn = '<a id="OpenGJMChargeMX' + index + '"  onclick="GJMChargeMX(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\')" href="javascript:void(0)">国家码交易</a>';
                                        }
                                    },
                                 {
                                     field: 'opt', title: '操作', width: 10, align: 'center', frozen: 'true',
                                     formatter: function (value, rec) {
                                         if ((rec.SubmitLogo == true && rec.MedicalStateCode != 2 && '@ViewData["SuperRole"]' == "") || '@ViewData["RolePermissionEdit"]' == "") {
                                             return btn = '<a id="edit' + index + '" style="color: #7B7B7B;" onclick="" >编辑</a>';
                                         }
                                         else {
                                             var LoginName = '@ViewData["LoginName"]';
                                             var WorkCode = '@ViewData["WorkCode"]';//20160531-判断是否有编辑权限的时候修改为取工号
                                             var FirstAcceptTime = Date.parse(row.FirstAcceptTime);//派车时刻
                                             var TimePatientRecordNotUp = Date.parse(('@ViewData["TimePatientRecordNotUp"]').replace(/-/g, "/"));//超时归档计算后值
                                             var UpdateFormCompleteTime = '';
                                             if (rec.UpdateFormCompletePerson != '') {
                                                 UpdateFormCompleteTime = Date.parse(rec.UpdateFormCompletePerson);//病历退回操作时间
                                             }

                                             if ((rec.PatientVersion == "救治" || rec.PatientVersion == "急救转院" || rec.PatientVersion == "一般转院" || rec.PatientVersion == "取暖箱") && '@ViewData["PatientRole"]' == "Driver") {
                                                 return btn = '<a id="edit' + index + '" style="color: #7B7B7B;" onclick="" >编辑</a>';
                                             }
                                             else if (rec.SubmitLogo == false && (row.Driver.indexOf(WorkCode) >= 0 || row.Doctor.indexOf(WorkCode) >= 0 || row.Nurse.indexOf(WorkCode) >= 0)
                                                 && FirstAcceptTime <= TimePatientRecordNotUp && (rec.FormCompleteLogo == null || rec.FormCompleteLogo == 0)
                                                 && UpdateFormCompleteTime != '' && UpdateFormCompleteTime > TimePatientRecordNotUp) {
                                                 //alert(10);
                                                 return btn = '<a id="editcls' + index + '" onclick="editRow(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + 'edit' + '\',\'' + rec.ForHelpTelephone + '\')" href="javascript:void(0)">编辑</a>';
                                             }
                                             else if (rec.SubmitLogo == false && (row.Driver.indexOf(WorkCode) >= 0 || row.Doctor.indexOf(WorkCode) >= 0 || row.Nurse.indexOf(WorkCode) >= 0)
                                                  && FirstAcceptTime > TimePatientRecordNotUp) {
                                                 //alert(11);
                                                 return btn = '<a id="editcls' + index + '" onclick="editRow(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + 'edit' + '\',\'' + rec.ForHelpTelephone + '\')" href="javascript:void(0)">编辑</a>';
                                             }
                                                 //20161129--增加病历提交后，若病历状态为抽查未通过， 医生也可以修改病历
                                             else if ((rec.SubmitLogo == true && (rec.MedicalStateCode == 2 || '@ViewData["SuperRole"]' == "SuperRole"))) {
                                                 return btn = '<a id="editcls' + index + '" onclick="editRow(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + 'edit' + '\',\'' + rec.ForHelpTelephone + '\')" href="javascript:void(0)">编辑</a>';
                                             }
                                             else
                                                 return btn = '<a id="edit' + index + '" style="color: #7B7B7B;" onclick="" >编辑</a>';
                                         }
                                     }
                                 }, {
                                     field: 'opt1', title: '操作', width: 15, align: 'center', frozen: 'true',
                                     formatter: function (value, rec) {
                                         if ('@ViewData["RolePermissionLook"]' == "Look" && rec.SubmitLogo == true)
                                             return btn = '<a id="lookcls' + index + '" onclick="editRow(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + 'look' + '\',\'' + rec.ForHelpTelephone + '\')" href="javascript:void(0)">查看/回访</a>';
                                         else if ('@ViewData["RolePermissionLook"]' == "Look" && rec.SubmitLogo == false)
                                             return btn = '<a id="lookcls' + index + '" onclick="editRow(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + 'look' + '\',\'' + rec.ForHelpTelephone + '\')" href="javascript:void(0)">查看/回访</a>';
                                         else
                                             return btn = '<a id="lookcls' + index + '" style="color: #7B7B7B;" onclick="" >查看/回访</a>';
                                     }
                                 },
                                {
                                    field: 'opt2', title: '操作', width: 10, align: 'center', frozen: 'true',
                                    formatter: function (value, rec) {
                                        var WorkCode = '@ViewData["WorkCode"]';//20161123-判断是否有删除权限的时候修改为取工号
                                        if ((rec.SubmitLogo == true && '@ViewData["SuperRole"]' == "") || '@ViewData["RolePermissionDelete"]' == "") {
                                            return btn = '<a id="delete' + index + '" style="color: #7B7B7B;" onclick="" >删除</a>';
                                        }
                                            //else if ((rec.SubmitLogo == false) && row.Doctor.indexOf(WorkCode) >= 0) {
                                            //    return btn = '<a id="deletecls' + index + '" onclick="Delete(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + rec.Name + '\')" href="javascript:void(0)">删除</a>';
                                            //}
                                        else if ((rec.SubmitLogo == true && '@ViewData["SuperRole"]' == "SuperRole") || (rec.SubmitLogo == false && row.Doctor.indexOf(WorkCode) >= 0 && '@ViewData["RolePermissionDelete"]' == "Delete")) {

                                            return btn = '<a id="deletecls' + index + '" onclick="Delete(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + rec.Name + '\')" href="javascript:void(0)">删除</a>';
                                        }
                                        else
                                            return btn = '<a id="delete' + index + '" style="color: #7B7B7B;" onclick="" >删除</a>';

                                    }
                                },
                                {
                                    field: 'opt3', title: '预览', width: 10, align: 'center', frozen: 'true',
                                    formatter: function (value, rec) {
                                        var btn = '<a id="printcls' + index + '" onclick="openPrint(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + rec.PatientVersion + '\',\'' + rec.SubmitLogo + '\',\'' + rec.IsSeePeople + '\')" href="javascript:void(0)">预览</a>';
                                        return btn;
                                    }
                                },
                                {
                                    field: 'opt4', title: '收费', width: 10, align: 'center', frozen: 'true',
                                    formatter: function (value, rec) {
                                        if (rec.ForHelpTelephone == '未收')
                                            return btn = '<a id="chargecls' + index + '" style="color:red;" onclick="editChargeRow(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + rec.PatientVersion + '\',\'' + rec.ForHelpTelephone + '\',\'' + rec.SubmitLogo + '\',\'' + rec.MedicalStateCode + '\',\'' + rec.RescueType + '\',\'' + rec.LastUpdatePerson + '\',\'' + rec.CPRIFSuccess + '\')" href="javascript:void(0)">' + rec.ForHelpTelephone + '</a>';
                                        else
                                            return btn = '<a id="chargecls' + index + '" onclick="editChargeRow(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\',\'' + rec.PatientVersion + '\',\'' + rec.ForHelpTelephone + '\',\'' + rec.SubmitLogo + '\',\'' + rec.MedicalStateCode + '\',\'' + rec.RescueType + '\',\'' + rec.LastUpdatePerson + '\',\'' + rec.CPRIFSuccess + '\')" href="javascript:void(0)">' + rec.ForHelpTelephone + '</a>';

                                    }
                                },
                                {
                                    field: 'trace', title: '痕迹', width: 10, align: 'center', frozen: 'true',
                                    formatter: function (value, rec) {
                                        if (rec.Remark == '0')
                                            return btn = '<a id="trace' + index + '">无痕迹</a>';
                                            //return btn= $('#ddv' + index).datagrid('hideColumn', 'trace');
                                        else
                                            return btn = '<a id="trace' + index + '" style="color:red;" onclick="prTrace(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\')" href="javascript:void(0)">有痕迹</a>';

                                    }
                                },//2020-07-27 sr 增加查看病历附件 //add2024-07-12 plq移植
                                {
                                    field: 'PatientImg', title: '附件', width: '6%', align: 'center', frozen: 'true',
                                    formatter: function (value, rec) {
                                        if ('@ViewData["IsShowIMG"]' == "true") {
                                            if (rec.IMEI == '已上传')
                                                return btn = '<a id="PatientImg' + index + '"  onclick="prShowImg(\'' + rec.TaskCode + '\',\'' + rec.PatientOrder + '\')" href="javascript:void(0)">查看附件</a>';
                                            else
                                                return '<a class="easyui-linkbutton" data-options="iconCls:\'icon-cut\',disabled:true" >无附件</a>';
                                        }
                                        else
                                            return '<a class="easyui-linkbutton" data-options="iconCls:\'icon-cut\',disabled:true" >无权限</a>';
                                    }
                                }
                                //,
                                //{
                                //    field: 'ECG', title: '心电监护', width: 10, align: 'center', frozen: 'true',
                                //    formatter: function (value, rec) {
                                //        return btn = '<a id="ECG' + index + '"  onclick="prECG(\'' + rec.DeathCertificate + '\',\'' + rec.DiseaseCooperation + '\',\'' + rec.DiseaseNotCooperationSupplement + '\',\'' + rec.FormedConsent + '\')" href="javascript:void(0)">心电监护</a>';

                                //    }
                                //}
                                //执法记录仪录像 2024-10-22 plq
                                ,
                                {
                                    field: 'SaveOneselfMeasures', title: '指导仪录像', width: '9%', align: 'center', frozen: 'true',
                                    formatter: function (value, rec) {
                                        console.log(rec);
                                        if (rec.SaveOneselfMeasures == "" || rec.SaveOneselfMeasures == null)
                                            return "无";
                                        else {
                                            if ('@ViewData["RolePraiseRecord"]' == "PraiseRecord") //2023-09-05 zch
                                            {
                                                return btn = '<a id="RecorderRecord' + index + '"  onclick="prRecorderRecord(\'' + rec.SaveOneselfMeasures + '\')" href="javascript:void(0)">指导仪录像</a>';
                                            }
                                            else {
                                                return btn = '<a id="RecorderRecord' + index + '">无权限</a>';
                                            }
                                        }
                                    }
                                }
                                ]],
                                onResize: function () {
                                    $('#gridPatientList').datagrid('fixDetailRowHeight', index);
                                },
                                onLoadSuccess: function (data) {
                                    setTimeout(function () {
                                        $('#gridPatientList').datagrid('fixDetailRowHeight', index);
                                    }, 0);
                                    $('#editcls' + index).linkbutton({ text: '编辑', plain: true, iconCls: 'icon-edit', url: '/' });
                                    $('#lookcls' + index).linkbutton({ text: '查看/回访', plain: true, iconCls: 'icon-custom-View', url: '/' });
                                    $('#deletecls' + index).linkbutton({ text: '删除', plain: true, iconCls: 'icon-remove', url: '/' });
                                    $('#printcls' + index).linkbutton({ text: '预览', plain: true, iconCls: 'icon-print', url: '/' });
                                    //$('#ECG' + index).linkbutton({ text: '', plain: true, iconCls: 'icon-custom-cECG', url: '/' });
                                    //$('#chargecls' + index).linkbutton({ text: '收费', plain: true, iconCls: 'icon-custom-cSaveCharge', url: '/' });
                                }
                            });
                        }
                        $('#gridPatientList').datagrid('fixDetailRowHeight', index);

                        if ('@ViewData["SuperRole"]' == "")
                            $('#ddv' + index).datagrid('hideColumn', 'trace');//隐藏痕迹列20160108
                    }
                });
                //$("#gridPatientList").datagrid('hideColumn', 'Code');//隐藏编码列20150111
            }
            else {
                $.showMsg("查询时间超过200天！请修改时间后重新查询！", "提示");
            }

            //设置分页控件
            var p = $('#gridPatientList').datagrid('getPager');
            $(p).pagination({
                beforePageText: '第',//页数文本框前显示的汉字
                afterPageText: '页    共 {pages} 页',
                displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',

            });
        }


        //查询方法
        function reSearch() {
            var WorkCode = '@ViewData["WorkCode"]';
            if (WorkCode == '' && '@ViewData["WorkCode"]' != "") {
                $.showMsg("请联系技术人员！管理系统人员工号为空，无法查询信息！", "提示");
            }
            var startTime = $("#startTime").datetimebox('getValue');
            var endTime = $('#endTime').datetimebox('getValue');
            startTime = startTime.replace(/-/g, "/");
            endTime = endTime.replace(/-/g, "/");
            var date1 = Date.parse(startTime);
            var date2 = Date.parse(endTime);

            //var d1 = new Date(startTime.replace(/-/g, "/"));
            //var d2 = new Date(endTime.replace(/-/g, "/"));
            var day = Math.ceil((date2 - date1) / (24 * 60 * 60 * 1000));
            if (day < 200) {
                $('#gridPatientList').datagrid({
                    pageNumber: 1,
                    queryParams: {
                        startTime: $("#startTime").datetimebox('getValue'),
                        endTime: $('#endTime').datetimebox('getValue'),
                        isTest: SplitArray(GetCheckBox("isTest")),//$('#isTest').val(),
                        patientName: $('#patientName').val(),
                        linkPhone: $('#linkPhone').val(),
                        alarmEventType: $('#alarmEventType').combobox('getValue') == "" ? -1 : $('#alarmEventType').combobox('getValue'),
                        localAddr: $('#localAddr').val(),
                        driver: $('#driver').val(),
                        centerCode: $('#centerCode').combobox('getValue') == "" ? -1 : $('#centerCode').combobox('getValue'),
                        stationCode: $('#stationCode').combobox('getValue') == "" ? -1 : $('#stationCode').combobox('getValue'),
                        ambCode: $('#ambCode').combobox('getValue') == "" ? -1 : $('#ambCode').combobox('getValue'),
                        doctor: $('#doctor').val(),
                        litter: $('#taskOrder').val(),
                        nurse: $('#nurse').val(),
                        taskResult: $('#taskResult').combobox('getValue') == "" ? -1 : $('#taskResult').combobox('getValue'),
                        taskAbendReason: $('#taskAbendReason').combobox('getValue') == "" ? -1 : $('#taskAbendReason').combobox('getValue'),
                        CPRIFSuccess: $('#CPRIFSuccess').combobox('getValue') == "" ? -1 : $('#CPRIFSuccess').combobox('getValue'),
                        PatientState: $('#PatientState').combobox('getValue') == "" ? -1 : $('#PatientState').combobox('getValue'),
                        isCharge: $('#isCharge').combobox('getValue') == "" ? -1 : $('#isCharge').combobox('getValue'),
                        isFill: $('#isFill').combobox('getValue') == "" ? -1 : $('#isFill').combobox('getValue'),
                        fapiaoHao: $('#fapiaoHao').val(),
                        illState: $('#illState').combobox('getValue') == "--请选择--" ? -1 : $('#illState').combobox('getValue'),
                        SendAddress: $('#SendAddress').combobox('getValue') == "--请选择--" ? -1 : isNullOrEmptyString($('#SendAddress').datebox('getText').replace(/\\/g, "")),
                        searchBound: '@ViewData["searchBound"]',
                        isYBPay: $('#IsYBPay').combobox('getValue') == "" ? -1 : $('#IsYBPay').combobox('getValue'),  //20211019 plq 医保上线移植
                        isVideoRecord: $('#IsVideoRecord').combobox('getValue') == "" ? -1 : $('#IsVideoRecord').combobox('getValue'), //2024-10-22 plq 指导仪录像
                        isPatientImg: $('#IsPatientImg').combobox('getValue') == "" ? -1 : $('#IsPatientImg').combobox('getValue') //2024-11-15 plq 附件
                    }
                });
            }
            else {
                $.showMsg("查询时间超过200天！请修改时间后重新查询！", "提示");
            }
        }

        //20160119病历自动归档后退回病历可以编辑
        function formComplete(TaskCode, PatientOrder, LoginName) {
            $.messager.confirm('退回病历', '是否确定要退回病历？', function (r) {
                if (r) {
                    $.ajax({
                        url: '@Url.Content("~/PR/Medical/FormComplete")',
                        type: "POST",
                        data: {
                            TaskCode: TaskCode,
                            PatientOrder: PatientOrder,
                            UpdateFormCompletePerson: LoginName
                        },
                        success: function (msg) {
                            if (msg == 'True') {
                                msgShow('系统提示', '</br><span style="color:#15428B;"> &nbsp;&nbsp;&nbsp;&nbsp;<b>病历退回成功！</b></span>', 'info');
                                $("#gridPatientList").datagrid("reload");
                                //bindGrid();//执行查询按钮，刷新数据
                            } else {
                                msgShow('系统提示', '</br><span style="color:#15428B;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>存储错误，请联系技术人员！</b></span>', 'error');

                            }
                        },
                        error: function () {
                            msgShow('系统提示', '</br><span style="color:#15428B;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>存储错误，请联系技术人员！</b></span>', 'error');

                        }
                    });
                }
            });
        }

        //20160108病历修改痕迹页面
        function prTrace(taskCode, PatientOrder) {

            // $('#DeliveryDetailList').dialog('open');
            @*$.ajax({
                type: 'POST',
                url: '@Url.Content("~/PR/PRTrace/PRTraceList")',
                data:
                    {
                        TaskCode: taskCode,
                        PatientOrder: PatientOrder
                    },
                dataType: "json",
                success: function (msg) {

                }
            });*@
            var url = '@Url.Content("~/PR/PRTrace/PRTraceList/?TaskCode=")' + encodeURIComponent(taskCode) + '&PatientOrder=' + PatientOrder;//传编码
            //window.open(url, '_blank');
            window.open(url);

        }

        @*//20160420增加打开扁鹊ECG页面
    function prECG(CarNumber, startTime, endTime, IFExecuting) {
        //var LicensePlateNumber = '新科测试';
        //var startTime = '2016-04-20 14:20:20';
        //var endTime = '2016-04-20 16:20:20';
        var ecgurl = '@ViewData["ECGURL"]' + "CarNumber=";
            var url;
            //alert(IFExecuting);
            if (IFExecuting == 'true') {
                url = ecgurl + encodeURIComponent(CarNumber) + '&TaskStartTime=&TaskEndTime=';//传编码
            }
            else {
                url = ecgurl + encodeURIComponent(CarNumber) + '&TaskStartTime=' + startTime + '&TaskEndTime=' + endTime;//传编码
            }
            //window.open(url, '_blank');
            window.open(url);

        }*@

        //EasyUI用DataGrid用日期格式化
        function DateFormatter(value, row, index) {
            if (value == undefined) {
                return "";
            }
            /*json格式时间转js时间格式*/
            //if (dateValue.getFullYear() < 1900) {
            //    return "";
            //}
            var unixTimestamp = new Date(parseInt(value.substring(value.indexOf('(') + 1, value.indexOf(')'))));
            var y = unixTimestamp.getFullYear();
            var m = unixTimestamp.getMonth() + 1;
            var d = unixTimestamp.getDate();
            return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d);
            //return unixTimestamp.getFullYear() + "-" + unixTimestamp.getMonth() + "-" + unixTimestamp.getDate();
        }

        //弹出病历修改页面
        function editRow(taskCode, PatientOrder, state, IsCharge) {
            //20161121--允许填写多个病历
            //20151120增加判断，如果是新增，从数据库查询判断是否已经填写病历，如果已经填写病历提示，并且刷新查询！
            @*if (state == "new") {
                $.ajax({
                    type: 'POST',
                    url: '@Url.Content("~/PR/Medical/IFFillPatientRecord")',
                data:
                    {
                        TaskCode: taskCode
                    },
                dataType: "json",
                success: function (msg) {
                    if (msg == "1") {
                        //未填写病历
                        openPatient(taskCode, PatientOrder, state);
                    }
                    else {
                        //已经填写病历
                        $.showMsg("病历已经填写！请重新查询！", "提示");
                        reSearch();//20151110查询查询列表
                    }
                }
            })
        }
        else {*@
            openPatient(taskCode, PatientOrder, state, IsCharge);
            //}
        }

        //2020-07-27 sr //add2024-07-12 plq 病例附件图片 移植
        function prShowImg(taskCode, PatientOrder) {
            var url = '@Url.Content("~/PR/Medical/ShowImg/?TaskCode=")' + encodeURIComponent(taskCode) + '&PatientOrder=' + PatientOrder;//传编码
            window.open(url);
        }
        //20151111弹出病历页面
        function openPatient(taskCode, PatientOrder, state, IsCharge) {
            var url = '@Url.Content("~/PR/Medical/AddPatientRecord/?taskCode=")' + encodeURIComponent(taskCode) + '&PatientOrder=' + PatientOrder + '&state=' + state + '&IsCharge=' + IsCharge;//传编码
            //window.open(url, '_blank');
            window.open(url);
        }


        //弹出收费页面
        function editChargeRow(taskCode, PatientOrder, AlarmeventType, ChargeType, SubmitLogo, MedicalStateCode, IsYB, IsYL, IsGJM) {
            //20170112--增加MedicalStateCode
            var url = '@Url.Content("~/PR/Charge/PatinetCharge/?taskCode=")' + encodeURIComponent(taskCode) + '&PatientOrder=' + PatientOrder + '&AlarmeventType=' + AlarmeventType + '&ChargeType=' + ChargeType + '&SubmitLogo=' + SubmitLogo + '&MedicalStateCode=' + MedicalStateCode + '&IsYB=' + IsYB + '&IsYL=' + IsYL + '&IsGJM=' + IsGJM;//传编码
            //window.open(url, '_blank');
            window.open(url);
        }

        //弹出医保交易页面 add2021-10-19 plq 医保上线移植
        function YBChargeMX(taskCode, patientorder) {
            var baseUrl = '@ViewData["YBWebChargeMX"]';
            baseUrl = baseUrl + '?TaskCode=' + encodeURIComponent(taskCode) + '&PatientOrder=' + patientorder
            window.open(baseUrl);
            //openNewPage("diagAccidentCombine", baseUrl + '?TaskCode=' + taskCode + '&PatientOrder=' + patientorder, "医保详情", '99%', '99%');
        }

        //弹出国家码交易页面 add2022-03-28 plq 医保国家码上线移植
        function GJMChargeMX(taskCode, patientorder) {
            var baseUrl = '@ViewData["YBWebGJMChargeMX"]';
            var GJMReturn = '@ViewData["GJMReturn"]';
            baseUrl = baseUrl + '?TaskCode=' + encodeURIComponent(taskCode) + '&PatientOrder=' + patientorder + '&GJMReturn=' + GJMReturn;
            window.open(baseUrl);
            //openNewPage("diagAccidentCombine", baseUrl + '?TaskCode=' + taskCode + '&PatientOrder=' + patientorder, "医保详情", '99%', '99%');
        }

        //2023-08-15 zch //打开执行记录仪录像 add2024-10-22 plq
        function prRecorderRecord(paths) {
            var arr = paths.split(',');
            //console.log(arr);
            for (var i = 0; i < arr.length; i++) {
                //http://
                if (arr[i].substring(0, 4) == "http")
                    window.open(arr[i]);
                else
                    window.open("http://" + arr[i]);
            }

            //window.open(paths, '_blank');
            //window.open(path);
        }


        //判断病历数大于等于1的变为红色；
        function formatPRNumber(val, row) {
            if (val >= 1) {
                return '<span style="color:red;">' + val + '</span>';
            } else {
                return val;
            }
        }

        function selctRadioButton(mainID, node) {
            document.getElementById("RadioButtonList_" + mainID + "_" + node + "").checked = "checked";
            document.getElementById("" + mainID + "").value = document.getElementById("RadioButtonList_" + mainID + "_" + node + "").value;

        }
        function formatNew(value, row) {
            if ('@ViewData["RolePermissionInsert"]' == "Insert") {
                if (row.PatientNumber >= row.PatientNum) {
                    //return '<a id="news' + row.TaskCode + '" plain="true" iconCls="icon-edit" onclick="editRow(\'' + row.TaskCode + '\',\'' + -1 + '\',\'' + 'new' + '\')" href="javascript:void(0)">新增</a>';
                    return '<a class="easyui-linkbutton" data-options="iconCls:\'icon-cut\',disabled:true" >已增加</a>';
                }
                else {
                    var workCode = '@ViewData["WorkCode"]';//登录人员工号20160201
                    if ((row.EventType == "救治" || row.EventType == "转院") && '@ViewData["PatientRole"]' == "Driver") {
                        return '<a class="easyui-linkbutton" data-options="iconCls:\'icon-cut\',disabled:true" >无权限</a>';
                    }
                        //20160921--测试注释
                    else if ('@ViewData["PatientRole"]' == "Nurse" && (row.Driver.indexOf(workCode) >= 0 || row.Doctor.indexOf(workCode) >= 0 || row.Nurse.indexOf(workCode) >= 0)) {
                        return '<a id="news' + row.TaskCode + '" plain="true" iconCls="icon-edit" onclick="editRow(\'' + row.TaskCode + '\',\'' + -3 + '\',\'' + 'new' + '\',\'' + '未收' + '\')" href="javascript:void(0)">新增</a>';
                    }
                    else if ((row.Driver.indexOf(workCode) < 0 && row.Doctor.indexOf(workCode) < 0 && row.Nurse.indexOf(workCode) < 0)) {
                        return '<a class="easyui-linkbutton" data-options="iconCls:\'icon-cut\',disabled:true" >无权限</a>';
                    }
                    else
                        return '<a id="news' + row.TaskCode + '" plain="true" iconCls="icon-edit" onclick="editRow(\'' + row.TaskCode + '\',\'' + -1 + '\',\'' + 'new' + '\',\'' + '未收' + '\')" href="javascript:void(0)">新增</a>';
                }
            }
            else {
                return '<a class="easyui-linkbutton" data-options="iconCls:\'icon-cut\',disabled:true" >无权限</a>';
            }
        }

        //删除病历
        function Delete(TaskCode, PatientOrder, Name) {
            $.messager.confirm('删除病人信息', '是否确定要删除姓名为："' + Name + '"的病历？', function (r) {
                if (r) {
                    $.ajax({
                        url: '@Url.Content("~/PR/Medical/DelectPatient")',
                        type: "POST",
                        data: {
                            TaskCode: TaskCode,
                            PatientOrder: PatientOrder
                        },
                        success: function (msg) {
                            if (msg == 'True') {
                                msgShow('系统提示', '</br><span style="color:#15428B;"> &nbsp;&nbsp;<b>删除成功！</b></span>', 'info');
                                $("#gridPatientList").datagrid("reload");
                                //bindGrid();//执行查询按钮，刷新数据
                            } else {
                                msgShow('系统提示', '</br><span style="color:#15428B;"> &nbsp;&nbsp;<b>存储错误，请联系技术人员！</b></span>', 'error');

                            }
                        },
                        error: function () {
                            msgShow('系统提示', '</br><span style="color:#15428B;"> &nbsp;&nbsp;<b>存储错误，请联系技术人员！</b></span>', 'error');

                        }
                    });
                }
            });
        }

        //#region 获取
        /*
        Name:控件名称
        */
        function GetCheckBox(Name) {
            var chk_value = [];
            $('input[name="' + Name + '"]:checked').each(function () {
                chk_value.push($(this).val());
            });
            return chk_value;
        }
        //#endregion

        //#region 遍历数组，组成带","号的字符串
        /*
        Array:数组名称
        */
        function SplitArray(Array) {
            var ArrayValue = '';
            if (Array.length > 1) {
                $.each(Array, function (key, val) {
                    ArrayValue += val + ",";
                });
            } else {
                $.each(Array, function (key, val) {
                    ArrayValue += val;
                });
            }
            return ArrayValue;
        }
        //#endregion

        //#region 判断非空，返回字符串。
        function isNullOrEmptyString(strVal) {
            if (strVal == '' || strVal == null || strVal == undefined || strVal == 'undefined' || strVal == 'null' || strVal == '--请选择--' || strVal == '请选择') {
                return "-1";
            } else {
                return strVal;
            }
        }
        //#endregion

        //打开打印页面 //edit2024-07-15 plq 增加 IsSeePeople 空车是否见人 传参
        function openPrint(TaskCode, PatientOrder, AlarmeventType, SubmitLogo, IsSeePeople) {
            var url = '@Url.Content("~/PR/Print/PatientRecordPrint/?TaskCode=")' + encodeURIComponent(TaskCode) + '&PatientOrder=' + PatientOrder + '&AlarmeventType=' + AlarmeventType + '&SubmitLogo=' + SubmitLogo + '&IsSeePeople=' + IsSeePeople;//传编码

            window.open(url);
        }

    </script>
}

<div style="margin: 10px 0;"></div>
<table id="gridPatientList" class="easyui-datagrid" align="center"
       @*data-options="pagination:true,rownumbers:true,singleSelect:true,fit:true,fitColumns:true" *@>
    <thead>
        <tr>
            <th data-options="field:'TaskCode', width:0,hidden: 'true'">编码</th>
            <th data-options="field:'PatientNum', width:0,hidden: 'true'">患者人数</th>
            <th data-options="field:'PatientNumber', width:'3%',align:'center',formatter:formatPRNumber">病历数</th>
            <th data-options="field:'PatientName', width:'0',align:'center',hidden: 'true'">患者</th>
            <th data-options="field:'FirstAcceptTime', width:'12%',align:'center', resizable: false">派车时刻</th>
            @*<th data-options="field:'AcceptType', width:'6%',align:'center',sortable: false, resizable: false">受理类型</th>*@
            <th data-options="field:'ContactTelephone', width:'7%',align:'center', resizable: false">联系电话</th>
            <th data-options="field:'EventType', width:'7%',align:'center',sortable: false">事件类型</th>
            <th data-options="field:'SceneAddress', width:'13%' ,align:'left'">现场地址</th>
            <th data-options="field:'Station', width:'7%',align:'center', resizable: false">分站</th>
            <th data-options="field:'ActualLogo', width:'5%',align:'center', resizable: false">车辆</th>
            <th data-options="field:'Driver', width:'8%',align:'center', resizable: false">司机</th>
            <th data-options="field:'Doctor', width:'8%',align:'center', resizable: false">医生</th>
            <th data-options="field:'Nurse', width:'8%',align:'center', resizable: false">护士</th>
            <th data-options="field:'StretcherBearers', width:'8%',align:'center', resizable: false">担架员</th>
            <th data-options="field:'OutCarResults', width:'6%',align:'center', resizable: false">出车结果</th>
            <th data-options="field:'new', width:'5%',align:'center',resizable:false,iconCls:'icon-edit',formatter:formatNew">病历</th>
        </tr>
    </thead>
</table>

<div id="tb" style="padding: 5px; height: auto">
    <div data-options="region:'north',split:true">
        <table style="width: 100%;" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td align="right">开始时刻：</td>
                <td>
                    <input class="easyui-datetimebox" style="width:142px" id="startTime" data-options="editable: false">
                </td>
                <td align="right">终止时刻：</td>
                <td>
                    <input class="easyui-datetimebox" style="width: 142px" id="endTime" data-options="editable: false">
                </td>
                <td align="right">是否测试：</td>
                <td>
                    <span id="isTest">
                        <input id="RadioButtonList_isTest_0" type="radio" name="isTest" value="-1" /><label for="RadioButtonList_isTest_0">全部</label>
                        <input id="RadioButtonList_isTest_1" type="radio" name="isTest" value="True" /><label for="RadioButtonList_isTest_1">是</label>
                        <input id="RadioButtonList_isTest_2" type="radio" name="isTest" value="False" checked="checked" /><label for="RadioButtonList_isTest_2">否</label>
                        @*<input id="RadioButtonList_isTest_0" type="radio" name="isTest" value="-1" onclick="javascript: setTimeout('selctRadioButton(\'isTest\',\'0\')', 0)" /><label for="RadioButtonList_isTest_0">全部</label>
                            <input id="RadioButtonList_isTest_1" type="radio" name="isTest" value="True" onclick="javascript: setTimeout('selctRadioButton(\'isTest\',\'1\')', 0)" /><label for="RadioButtonList_isTest_1">是</label>
                            <input id="RadioButtonList_isTest_2" type="radio" name="isTest" value="False" checked="checked" onclick="javascript: setTimeout('selctRadioButton(\'isTest\',\'2\')', 0)" /><label for="RadioButtonList_isTest_2">否</label>*@
                    </span>

                </td>
                <td align="right">是否医保交易:</td>
                <td>
                    <select class="easyui-combobox" style="width: 120px" id="IsYBPay" data-options="editable: false,panelHeight: 'auto'">
                        <option value="-1">--请选择--</option>
                        <option value="0">无五期医保</option>
                        <option value="1">有五期医保</option>
                        <option value="2">无国家码</option>
                        <option value="3">有国家码</option>
                    </select>
                </td>
                <td align="right">流水号：</td>
                <td>
                    <input class="easyui-textbox" type="text" style="width: 120px" id="taskOrder">
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td align="right">现场地址：</td>
                <td>
                    <input class="easyui-textbox" type="text" style="width: 142px" id="localAddr">
                </td>
                <td align="right">事件类型：</td>
                <td>
                    <select class="easyui-combobox" style="width: 142px" id="alarmEventType"></select>
                </td>
                <td align="right">联系电话：</td>
                <td>
                    <input class="easyui-textbox" type="text" style="width: 130px" id="linkPhone">
                </td>
                <td align="right">患者姓名：</td>
                <td>
                    <input class="easyui-textbox" type="text" style="width: 120px" id="patientName">
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td align="right">分中心：</td>
                <td>
                    <select class="easyui-combobox" style="width: 142px" id="centerCode" data-options="editable: false,panelHeight: 'auto'"></select>
                </td>
                <td align="right">分站：</td>
                <td>
                    <select class="easyui-combobox" style="width: 142px;" id="stationCode" data-options=""></select>
                </td>
                <td align="right">车辆：</td>
                <td>
                    <select class="easyui-combobox" style="width: 130px" id="ambCode" data-options=""></select>
                </td>
                <td align="right">司机：</td>
                <td>
                    <input class="easyui-textbox" type="text" style="width: 120px" id="driver" data-options="prompt:'可输入工号'">
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td align="right">医生：</td>
                <td>
                    <input class="easyui-textbox" type="text" style="width: 142px" id="doctor" data-options="prompt:'可输入工号'">
                </td>
                <td align="right">护士：</td>
                <td>
                    <input class="easyui-textbox" type="text" style="width: 142px" id="nurse" data-options="prompt:'可输入工号'">
                </td>
                <td align="right">出车结果：</td>
                <td>
                    <select class="easyui-combobox" style="width: 130px" id="taskResult" data-options="editable: false,panelHeight: 'auto'">
                        <option value="-1">--请选择--</option>
                        <option value="True">正常</option>
                        <option value="False">异常结束</option>
                    </select>
                </td>
                <td align="right">异常结束原因：</td>
                <td>
                    <select class="easyui-combobox" style="width: 120px" id="taskAbendReason" data-options="editable: false,panelHeight: 'auto'">
                        <option value="-1">--请选择--</option>
                        <option value="车到未送">车到未送</option>
                        <option value="途中召回">途中召回</option>
                        <option value="车到人走">车到人走</option>
                        <option value="车到不要(未诊治)">车到不要(未诊治)</option>
                        <option value="突发事件">突发事件</option>
                        <option value="其他">其他</option>
                    </select>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td align="right">审核情况：</td>
                <td>
                    <select class="easyui-combobox" style="width: 142px" id="isFill" data-options="editable: false">
                        <option value="-1">--请选择--</option>
                        <option value="中心未抽查">中心未抽查</option>
                        <option value="中心已抽查">中心已抽查</option>
                        <option value="中心抽查待定">中心抽查待定</option>
                        <option value="中心抽查优秀">中心抽查优秀</option>
                        <option value="中心抽查良好">中心抽查良好</option>
                        <option value="中心抽查合格">中心抽查合格</option>
                        <option value="中心抽查未通过">中心抽查未通过</option>
                        <option value="中心抽查进步">中心抽查进步</option>
                        <option value="分站未抽查">分组未抽查</option>
                        <option value="分站已抽查">分组已抽查</option>
                        <option value="分站抽查待定">分组抽查待定</option>
                        <option value="分站抽查优秀">分组抽查优秀</option>
                        <option value="分站抽查良好">分组抽查良好</option>
                        <option value="分站抽查合格">分组抽查合格</option>
                        <option value="分站抽查未通过">分组抽查未通过</option>
                        <option value="已通知参加小讲课">已通知参加小讲课</option>
                        <option value="实际参加小讲课未填写">实际参加小讲课未填写</option>
                        <option value="实际小讲课缺席参加">实际小讲课缺席参加</option>
                    </select>
                </td>
                <td align="right">病历状态：</td>
                <td>
                    <select class="easyui-combobox" style="width: 142px" id="PatientState" data-options="editable: false,panelHeight: 'auto'">
                        <option value="-1">--请选择--</option>
                        <option value="True">已填</option>
                        <option value="False">未填</option>
                        <option value="0">暂存</option>
                        <option value="1">已提交</option>
                        <option value="2">未通过</option>
                        <option value="3">修改后提交</option>
                        <option value="自动归档">自动归档</option>
                        <option value="已回访">已回访</option>
                        <option value="未回访">未回访</option>
                    </select>
                </td>
                <td align="right">心肺复苏：</td>
                <td>
                    <select class="easyui-combobox" style="width: 130px;" id="CPRIFSuccess" data-options="editable: false,panelHeight: 'auto'">
                        <option value="-1">--请选择--</option>
                        <option value="ROSC">ROSC</option>
                        <option value="已审核">已审核</option>
                        <option value="未审核">未审核</option>
                        <option value="通过">审核通过</option>
                        <option value="未通过">审核未通过</option>
                        <option value="待定">待定</option>
                        <option value="已回访">已回访</option>
                        <option value="未回访">未回访</option>
                        <option value="出院">出院</option>
                    </select>
                </td>
                <td align="right">收费情况：</td>
                <td>
                    <select class="easyui-combobox" style="width: 120px" id="isCharge" data-options="editable: false,panelHeight: 'auto'">
                        <option value="-1">--请选择--</option>
                        <option value="True">已收</option>
                        <option value="False">未收</option>
                        <option value="Different">应收与实收不符</option>
                        <option value="Match">应收与实收相符</option>
                        <option value="AgainInvoice">重开发票</option>
                        @*<option value="Qian">欠费</option>*@
                    </select>
                </td>
            </tr>
            <tr>
                <td align="right">发票号：</td>
                <td>
                    <input class="easyui-textbox" type="text" style="width: 142px" id="fapiaoHao">
                </td>
                <td align="right">病情分类：</td>
                <td>
                    <select class="easyui-combobox" style="width: 142px;" id="illState" data-options=""></select>
                </td>
                <td align="right">送往地点：</td>
                <td>
                    <select id="SendAddress" class="easyui-combobox" style="width: 130px;" data-options=""></select>
                </td>
                <td align="right">有无指导仪录像：</td>
                <td>
                    <select class="easyui-combobox" style="width: 120px" id="IsVideoRecord" data-options="editable: false,panelHeight: 'auto'">
                        <option value="-1">--请选择--</option>
                        <option value="1">有</option>
                        <option value="0">无</option>
                    </select>
                </td>
                <td align="right">有无附件：</td>
                <td>
                    <select class="easyui-combobox" style="width: 120px" id="IsPatientImg" data-options="editable: false,panelHeight: 'auto'">
                        <option value="-1">--请选择--</option>
                        <option value="1">有</option>
                        <option value="0">无</option>
                    </select>
                </td>
                <td></td>
                <td>
                    <a href="javascript:void(0)" id="btnSearch" class="easyui-linkbutton" onclick="reSearch()" data-options="iconCls:'icon-search'">查询</a>
                </td>
            </tr>
        </table>
    </div>
</div>
